import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'login',
      component: resolve => require(['@/components/admin/login'], resolve)
    },
    {
      path: '/index',
      name: 'index',
      component: resolve => require(['@/components/index'], resolve),
      children: [
        {
          path: '/clientPM',
          name: 'clientPM',
          component: resolve => require(['@/components/page/menu/clientPM'], resolve),
          children: [
            {
              path: '/dashboard',
              name: 'dashboard',
              component: resolve => require(['@/components/page/subPage/dashboard'], resolve)
            },
            {
              path: '/goodsall',
              name: 'goodsall',
              component: resolve => require(['@/components/page/subPage/goodsall'], resolve)
            },
            {
              path: '/goodsdetail/:id',
              name: 'goodsdetail',
              component: resolve => require(['@/components/page/subPage/goodsdetail'], resolve)
            },
            {
              path: '/category',
              name: 'category',
              component: resolve => require(['@/components/page/subPage/category'], resolve)
            },
            {
              path: '/addCategory',
              name: 'addCategory',
              component: resolve => require(['@/components/page/subPage/addCategory'], resolve)
            },
            {
              path: '/category/:subid',
              name: 'category',
              component: resolve => require(['@/components/page/subPage/category'], resolve)
            },
            {
              path: '/category/:id',
              name: 'categorydetail',
              component: resolve => require(['@/components/page/subPage/categorydetail'], resolve)
            },
            {
              path: '/order',
              name: 'order',
              component: resolve => require(['@/components/page/subPage/orderlist'], resolve)
            }
          ]
        },
        {
          path: '/appversion',
          name: 'appversion',
          component: resolve => require(['@/components/page/menu/appversion'], resolve),
          children: [
            {
              path: 'submenu',
              name: 'appversionsubmenu',
              component: resolve => require(['@/components/page/menu/subMenu/appversionSubmenu'], resolve),
              redirect: '/appversion/appversionList',
              children: [
                {
                  path: '/appversion/appversionList',
                  name: 'appversionList',
                  component: resolve => require(['@/components/page/subPage/appversionList'], resolve)
                },
                {
                  path: '/appversion/appversionNew',
                  name: 'appversionNew',
                  component: resolve => require(['@/components/page/subPage/appversionNew'], resolve)
                }
              ]
            }
          ]
        }
      ]
    }
  ]
})
